// 导入请求api
import { reqGetCategoryList } from "@/api"

const state = {
    category: []
}
const mutations = {
    setCategoryList(state, payload) {
        state.category = payload.category;
    }
}
const actions = {
    async getCategoryList({ commit }) {
        try {
            let re = await reqGetCategoryList();
            commit('setCategoryList', { category: re })
        } catch (err) {
            alert(err.message)
        }
    }
}
const getters = {}

export default {
    namespaced: true,
    state,
    mutations,
    actions,
    getters
}